﻿Public Class OptionsDialog

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
        Me.DialogResult = False
        Me.Close()
    End Sub

    Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
        Me.DialogResult = True

        My.Settings.MouseWheelZoom = Me.chkMouseWheelZoom.IsChecked.ToString
        My.Settings.MRUCount = Me.sldMRUCount.Value.ToString
        My.Settings.LoupeMagnification = Me.sldLoupe.Value
        My.Settings.CheckForUpdates = Me.chkUpdates.IsChecked
        My.Settings.ReportMetrics = Me.chkReptMetrics.IsChecked
        Me.Close()
    End Sub

    Private Sub OptionsDialog_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
        Me.chkMouseWheelZoom.IsChecked = CBool(My.Settings.MouseWheelZoom)
        Dim x As Integer = 0
        If Int32.TryParse(My.Settings.MRUCount, x) Then Me.sldMRUCount.Value = x
        Me.sldLoupe.Value = My.Settings.LoupeMagnification
        Me.chkUpdates.IsChecked = CBool(My.Settings.CheckForUpdates)
        Me.chkReptMetrics.IsChecked = My.Settings.ReportMetrics
    End Sub
End Class
